package by.ostrovsky.webhousingsystem.dao.implementation;

import org.hibernate.Session;

import by.ostrovsky.webhousingsystem.hibernate.HibernateUtil;

public class WizardTransactor {
	private Session session = null;

	public WizardTransactor(){
		session = HibernateUtil.getSessionFactory().openSession();
	}
	
	public void setSession(Session session){
		this.session = session;
	}
	
	public Session getSession(){
		return session;
	}
	
	public void begin() {
		session.beginTransaction();
	}

	public void commit() {
		session.getTransaction().commit();
	}

	public void rollback() {
		session.getTransaction().rollback();
	}

	public void close() {
		session.close();
	}
}
